08. Creating an EKS Cluster

Header

Creating an EKS Cluster

FSND C4 L2 A08 Creating A Cluster

Creating a cluster

To clarify, there are two consoles in AWS that can be used to manage EKS services: the EKS console , and the [CloudFormation console]( https://us-east-2.console.aws.amazon.com/cloudformation/
). CloudFormation allows you provision all the infrastructure resources that you will need using simple text files, and we will be using CloudFormation going forward in the course.

Creating an EKS Cluster

  • Create the cluster: eksctl create cluster --name eksctl-demo
  • Go to the [CloudFormation console]( https://us-east-2.console.aws.amazon.com/cloudformation/
    ) to view progress. If you don’t see any progress, be sure that you are viewing clusters is the same region that they are being created. For example, if eksctl is using region us-west-2 , you’ll need to set the region to “US West (Oregon)” in the dropdown menu in the upper right of the console.
  • Once the status is ‘CREATE_COMPLETE’, check the health of your clusters nodes: kubectl get nodes
  • From the CloudFormation console, select your stack and choose delete from the actions menu, or delete using eksctl: eksctl delete cluster eksctl-demo .

Summary of Command Line Tools

Note that you have now been introduced to three command line tools that you can use to work with AWS EKS services:

  • AWSCLI: This tool allows you to interact with a wide variety of AWS services, not just EKS. Although there are aws commands to create or modify EKS services, this is a much more manual approach than using the other options.
  • eksctl: This command line tool allows you to run commands against a kubernetes cluster. This is the best tool for creating or deleting clusters from the command line, since it will take care of all associated resources for you.
  • kubectl: This tool is used to interact with an existing cluster, but can’t be used to create or delete a cluster.

creating cluster

Which command creates an EKS cluster with default values, including nodes and vpc?

SOLUTION:
  • `eksctl create cluster`

creating cluster

Which command would you use to get the status of the nodes in your cluster?

SOLUTION: `kubectl get nodes`

creating cluster

How do you delete a cluster along with all of its associated resources?

SOLUTION:
  • Delete its stack in the CloudFormation console
  • Delete its stack using `eksctl delete cluster`

Delete Cluster Task

Task Description:

Delete the EKS Cluster

Task List:

Task Feedback:

Great work! Clusters are not free to run, so you want to be sure to delete unused clusters to avoid incurring costs.

Summary creating clusters

Creating a EKS Cluster: Key Points

  • eksctl makes it easy to create a cluster and all of the resources needed to use it
  • kubectl communicates the clusters master system and can be used to interact with nodes, pods, and services
  • When deleting a cluster, use eksctl delete or the CloudFormation console to avoid leaving dangling resources